* set paths
global P_Main "PATH_TO_MAIN_DIRECTORY_WHERE_THE_CODE_IS"
* where all data is
global P_Data "$P_Main/Data"

global P_GS "$P_Data/GS"
cd $P_GS
* installation
net describe osrmtime, from("$P_GS/osrmtime")

*** NEED TO SET OSRM DIRECTORY - SEE OSRM README FILES
global OSRM_DIR "PATH_TO_OSRM_DIRECTORY"

* download maps
 capture mkdir mymaps
 copy "http://ftp5.gwdg.de/pub/misc/openstreetmap/download.geofabrik.de/germany-latest.osm.pbf" "mymaps/germany.osm.pbf", replace

// prepare the map (this takes some time ~5 minutes, depending on your system):
 import latlon data
osrmprepare, mapfile("mymaps/germany.osm.pbf") osrmdir("$OSRM_DIR") profile(car)
* use station_pair_germany.dta, clear
* osrmtime OLat OLong DLat DLong, mapfile("mymaps/germany.osrm") osrmdir("C:\osrm\") threads(16)
* save station_pair_germany.dta, replace

use station_pair_germany_0.dta, clear
osrmtime OLat OLong DLat DLong, mapfile("mymaps/germany.osrm") osrmdir("$OSRM_DIR") threads(16)
save station_pair_germany_0.dta, replace

use station_pair_germany_1.dta, clear
osrmtime OLat OLong DLat DLong, mapfile("mymaps/germany.osrm") osrmdir("$OSRM_DIR") threads(16)
save station_pair_germany_1.dta, replace

use station_pair_germany_2.dta, clear
osrmtime OLat OLong DLat DLong, mapfile("mymaps/germany.osrm") osrmdir("$OSRM_DIR") threads(16)
save station_pair_germany_2.dta, replace

use station_pair_germany_3.dta, clear
osrmtime OLat OLong DLat DLong, mapfile("mymaps/germany.osrm") osrmdir("$OSRM_DIR") threads(16)
save station_pair_germany_3.dta, replace

use station_pair_germany_4.dta, clear
osrmtime OLat OLong DLat DLong, mapfile("mymaps/germany.osrm") osrmdir("$OSRM_DIR") threads(16)
save station_pair_germany_4.dta, replace

use station_pair_germany_5.dta, clear
osrmtime OLat OLong DLat DLong, mapfile("mymaps/germany.osrm") osrmdir("$OSRM_DIR") threads(16)
save station_pair_germany_5.dta, replace

use station_pair_germany_6.dta, clear
osrmtime OLat OLong DLat DLong, mapfile("mymaps/germany.osrm") osrmdir("$OSRM_DIR") threads(16)
save station_pair_germany_6.dta, replace

use station_pair_germany_7.dta, clear
osrmtime OLat OLong DLat DLong, mapfile("mymaps/germany.osrm") osrmdir("$OSRM_DIR") threads(16)
save station_pair_germany_7.dta, replace

use station_pair_germany_8.dta, clear
osrmtime OLat OLong DLat DLong, mapfile("mymaps/germany.osrm") osrmdir("$OSRM_DIR") threads(16)
save station_pair_germany_8.dta, replace

use station_pair_germany_9.dta, clear
osrmtime OLat OLong DLat DLong, mapfile("mymaps/germany.osrm") osrmdir("$OSRM_DIR") threads(16)
save station_pair_germany_9.dta, replace
